package edu.pku.sei.modeler.model.structure;

import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.w3c.dom.Element;

import edu.pku.sei.modeler.model.common.MetaTypedList;
import edu.pku.sei.modeler.model.xml.XMLUtility;

/**
 * @author klh
 *
 */

public class HandlerLocationManager extends LocationManager{
	public HandlerLocationManager(){
		super();		
	}
	public void locateSubParts(Point displace, Rectangle rect) {
		if(this.m_node_locator == null)return;
		for(int i=0;i<this.m_node_locator.size();i++){
			MetaNode node = ((MgrElement)m_node_locator.get(i)).getKey();
			node.setLocationX(node.getLocationX() + displace.x);
			node.setLocationY(node.getLocationY() + displace.y);
			int X = rect.x + rect.width - node.width;
			if (X < node.locationX)
			{
				displace.x = displace.x + X - node.locationX;
				node.setLocationX(X);
			}	
			HandlerActivityLocator relocator = new HandlerActivityLocator(node);
			relocator.reLocate(displace);
					
		}
	}

}
